package utils.common;

import org.apache.commons.collections.CollectionUtils;

import java.util.Collection;

/**
 * @author chao
 * @since 2015/1/12
 */
public class CollectionUtil extends CollectionUtils{

    public boolean isEmpty(Collection collection){
        if(collection == null){
            return true;
        }
        return collection.isEmpty();
    }

    public <T> T first(Collection<T> collection){
        if(isEmpty(collection)){
            return null;
        }
        return collection.iterator().next();
    }
}
